package o;

import java.util.Iterator;
import java.util.regex.Pattern;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public abstract class gck {

    public static abstract class c extends gck {
        String ˊ;
        String ˎ;

        public c(String str, String str2) {
            gbj.ॱ(str);
            gbj.ॱ(str2);
            this.ˎ = gbg.ˋ(str);
            if ((str2.startsWith("\"") && str2.endsWith("\"")) || (str2.startsWith("'") && str2.endsWith("'"))) {
                str2 = str2.substring(1, str2.length() - 1);
            }
            this.ˊ = gbg.ˋ(str2);
        }
    }

    public static final class a extends c {
        public a(String str, String str2) {
            super(str, str2);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˎ) && this.ˊ.equalsIgnoreCase(element2.attr(this.ˎ).trim());
        }

        public String toString() {
            return String.format("[%s=%s]", new Object[]{this.ˎ, this.ˊ});
        }
    }

    public static abstract class o extends gck {
        protected final int ˎ;
        protected final int ˏ;

        protected abstract String ˏ();

        protected abstract int ॱ(Element element, Element element2);

        public o(int i, int i2) {
            this.ˎ = i;
            this.ˏ = i2;
        }

        public boolean ˎ(Element element, Element element2) {
            Element ᐝॱ = element2.ᐝॱ();
            if (ᐝॱ == null || (ᐝॱ instanceof Document)) {
                return false;
            }
            int ॱ = ॱ(element, element2);
            if (this.ˎ == 0) {
                if (ॱ != this.ˏ) {
                    return false;
                }
                return true;
            } else if ((ॱ - this.ˏ) * this.ˎ < 0 || (ॱ - this.ˏ) % this.ˎ != 0) {
                return false;
            } else {
                return true;
            }
        }

        public String toString() {
            if (this.ˎ == 0) {
                return String.format(":%s(%d)", new Object[]{ˏ(), Integer.valueOf(this.ˏ)});
            } else if (this.ˏ == 0) {
                return String.format(":%s(%dn)", new Object[]{ˏ(), Integer.valueOf(this.ˎ)});
            } else {
                return String.format(":%s(%dn%+d)", new Object[]{ˏ(), Integer.valueOf(this.ˎ), Integer.valueOf(this.ˏ)});
            }
        }
    }

    public static final class aa extends o {
        public aa(int i, int i2) {
            super(i, i2);
        }

        protected int ॱ(Element element, Element element2) {
            return element2.ʿ() + 1;
        }

        protected String ˏ() {
            return "nth-child";
        }
    }

    public static class ab extends o {
        public ab(int i, int i2) {
            super(i, i2);
        }

        protected int ॱ(Element element, Element element2) {
            Elements ॱˎ = element2.ᐝॱ().ॱˎ();
            int i = 0;
            for (int ʿ = element2.ʿ(); ʿ < ॱˎ.size(); ʿ++) {
                if (((Element) ॱˎ.get(ʿ)).ʻॱ().equals(element2.ʻॱ())) {
                    i++;
                }
            }
            return i;
        }

        protected String ˏ() {
            return "nth-last-of-type";
        }
    }

    public static final class ac extends gck {
        public boolean ˎ(Element element, Element element2) {
            Element ᐝॱ = element2.ᐝॱ();
            return (ᐝॱ == null || (ᐝॱ instanceof Document) || element2.ʽॱ().size() != 0) ? false : true;
        }

        public String toString() {
            return ":only-child";
        }
    }

    public static final class ad extends o {
        public ad(int i, int i2) {
            super(i, i2);
        }

        protected int ॱ(Element element, Element element2) {
            return element2.ᐝॱ().ॱˎ().size() - element2.ʿ();
        }

        protected String ˏ() {
            return "nth-last-child";
        }
    }

    public static final class ae extends gck {
        private Pattern ˊ;

        public ae(Pattern pattern) {
            this.ˊ = pattern;
        }

        public boolean ˎ(Element element, Element element2) {
            return this.ˊ.matcher(element2.ˊˋ()).find();
        }

        public String toString() {
            return String.format(":matches(%s)", new Object[]{this.ˊ});
        }
    }

    public static final class af extends gck {
        private Pattern ˊ;

        public af(Pattern pattern) {
            this.ˊ = pattern;
        }

        public boolean ˎ(Element element, Element element2) {
            return this.ˊ.matcher(element2.ˊᐝ()).find();
        }

        public String toString() {
            return String.format(":matchesOwn(%s)", new Object[]{this.ˊ});
        }
    }

    public static final class ag extends gck {
        public boolean ˎ(Element element, Element element2) {
            if (element2 instanceof gbw) {
                return true;
            }
            for (gbx o_gbx : element2.ʾ()) {
                gbq o_gbw = new gbw(gcj.ˎ(element2.ˊॱ()), element2.ˏ(), element2.ͺ());
                o_gbx.ʼ(o_gbw);
                o_gbw.ˊ((gbq) o_gbx);
            }
            return false;
        }

        public String toString() {
            return ":matchText";
        }
    }

    public static final class ah extends gck {
        public boolean ˎ(Element element, Element element2) {
            Element ᐝॱ = element2.ᐝॱ();
            if (ᐝॱ == null || (ᐝॱ instanceof Document)) {
                return false;
            }
            Iterator it = ᐝॱ.ॱˎ().iterator();
            int i = 0;
            while (it.hasNext()) {
                int i2;
                if (((Element) it.next()).ʻॱ().equals(element2.ʻॱ())) {
                    i2 = i + 1;
                } else {
                    i2 = i;
                }
                i = i2;
            }
            if (i == 1) {
                return true;
            }
            return false;
        }

        public String toString() {
            return ":only-of-type";
        }
    }

    public static final class ai extends gck {
        public boolean ˎ(Element element, Element element2) {
            if (element instanceof Document) {
                element = element.ˎ(0);
            }
            if (element2 == element) {
                return true;
            }
            return false;
        }

        public String toString() {
            return ":root";
        }
    }

    public static final class ak extends gck {
        private String ˋ;

        public ak(String str) {
            this.ˋ = str;
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.ˊॱ().equalsIgnoreCase(this.ˋ);
        }

        public String toString() {
            return String.format("%s", new Object[]{this.ˋ});
        }
    }

    public static final class am extends gck {
        private String ˊ;

        public am(String str) {
            this.ˊ = str;
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.ˊॱ().endsWith(this.ˊ);
        }

        public String toString() {
            return String.format("%s", new Object[]{this.ˊ});
        }
    }

    public static final class b extends gck {
        private String ˋ;

        public b(String str) {
            gbj.ॱ(str);
            this.ˋ = gbg.ˎ(str);
        }

        public boolean ˎ(Element element, Element element2) {
            for (gbh ˊ : element2.ͺ().ˋ()) {
                if (gbg.ˎ(ˊ.ˊ()).startsWith(this.ˋ)) {
                    return true;
                }
            }
            return false;
        }

        public String toString() {
            return String.format("[^%s]", new Object[]{this.ˋ});
        }
    }

    public static final class d extends gck {
        private String ˊ;

        public d(String str) {
            this.ˊ = str;
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˊ);
        }

        public String toString() {
            return String.format("[%s]", new Object[]{this.ˊ});
        }
    }

    public static final class e extends gck {
        public boolean ˎ(Element element, Element element2) {
            return true;
        }

        public String toString() {
            return "*";
        }
    }

    public static final class f extends c {
        public f(String str, String str2) {
            super(str, str2);
        }

        public boolean ˎ(Element element, Element element2) {
            return !this.ˊ.equalsIgnoreCase(element2.attr(this.ˎ));
        }

        public String toString() {
            return String.format("[%s!=%s]", new Object[]{this.ˎ, this.ˊ});
        }
    }

    public static final class g extends c {
        public g(String str, String str2) {
            super(str, str2);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˎ) && gbg.ˎ(element2.attr(this.ˎ)).startsWith(this.ˊ);
        }

        public String toString() {
            return String.format("[%s^=%s]", new Object[]{this.ˎ, this.ˊ});
        }
    }

    public static final class h extends c {
        public h(String str, String str2) {
            super(str, str2);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˎ) && gbg.ˎ(element2.attr(this.ˎ)).endsWith(this.ˊ);
        }

        public String toString() {
            return String.format("[%s$=%s]", new Object[]{this.ˎ, this.ˊ});
        }
    }

    public static final class i extends gck {
        String ˊ;
        Pattern ˎ;

        public i(String str, Pattern pattern) {
            this.ˊ = gbg.ˋ(str);
            this.ˎ = pattern;
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˊ) && this.ˎ.matcher(element2.attr(this.ˊ)).find();
        }

        public String toString() {
            return String.format("[%s~=%s]", new Object[]{this.ˊ, this.ˎ.toString()});
        }
    }

    public static final class j extends c {
        public j(String str, String str2) {
            super(str, str2);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.hasAttr(this.ˎ) && gbg.ˎ(element2.attr(this.ˎ)).contains(this.ˊ);
        }

        public String toString() {
            return String.format("[%s*=%s]", new Object[]{this.ˎ, this.ˊ});
        }
    }

    public static final class k extends gck {
        private String ˏ;

        public k(String str) {
            this.ˏ = str;
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.ॱ(this.ˏ);
        }

        public String toString() {
            return String.format(".%s", new Object[]{this.ˏ});
        }
    }

    public static final class l extends gck {
        private String ॱ;

        public l(String str) {
            this.ॱ = gbg.ˎ(str);
        }

        public boolean ˎ(Element element, Element element2) {
            return gbg.ˎ(element2.ˊᐝ()).contains(this.ॱ);
        }

        public String toString() {
            return String.format(":containsOwn(%s)", new Object[]{this.ॱ});
        }
    }

    public static final class m extends gck {
        private String ॱ;

        public m(String str) {
            this.ॱ = gbg.ˎ(str);
        }

        public boolean ˎ(Element element, Element element2) {
            return gbg.ˎ(element2.ˊˋ()).contains(this.ॱ);
        }

        public String toString() {
            return String.format(":contains(%s)", new Object[]{this.ॱ});
        }
    }

    public static final class n extends gck {
        private String ˋ;

        public n(String str) {
            this.ˋ = gbg.ˎ(str);
        }

        public boolean ˎ(Element element, Element element2) {
            return gbg.ˎ(element2.ˋˊ()).contains(this.ˋ);
        }

        public String toString() {
            return String.format(":containsData(%s)", new Object[]{this.ˋ});
        }
    }

    public static abstract class r extends gck {
        int ˊ;

        public r(int i) {
            this.ˊ = i;
        }
    }

    public static final class p extends r {
        public p(int i) {
            super(i);
        }

        public boolean ˎ(Element element, Element element2) {
            return element != element2 && element2.ʿ() < this.ˊ;
        }

        public String toString() {
            return String.format(":lt(%d)", new Object[]{Integer.valueOf(this.ˊ)});
        }
    }

    public static final class q extends r {
        public q(int i) {
            super(i);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.ʿ() == this.ˊ;
        }

        public String toString() {
            return String.format(":eq(%d)", new Object[]{Integer.valueOf(this.ˊ)});
        }
    }

    public static final class s extends gck {
        private String ˎ;

        public s(String str) {
            this.ˎ = str;
        }

        public boolean ˎ(Element element, Element element2) {
            return this.ˎ.equals(element2.ॱᐝ());
        }

        public String toString() {
            return String.format("#%s", new Object[]{this.ˎ});
        }
    }

    public static final class t extends r {
        public t(int i) {
            super(i);
        }

        public boolean ˎ(Element element, Element element2) {
            return element2.ʿ() > this.ˊ;
        }

        public String toString() {
            return String.format(":gt(%d)", new Object[]{Integer.valueOf(this.ˊ)});
        }
    }

    public static final class u extends ab {
        public u() {
            super(0, 1);
        }

        public String toString() {
            return ":last-of-type";
        }
    }

    public static final class v extends gck {
        public boolean ˎ(Element element, Element element2) {
            Element ᐝॱ = element2.ᐝॱ();
            return (ᐝॱ == null || (ᐝॱ instanceof Document) || element2.ʿ() != ᐝॱ.ॱˎ().size() - 1) ? false : true;
        }

        public String toString() {
            return ":last-child";
        }
    }

    public static final class w extends gck {
        public boolean ˎ(Element element, Element element2) {
            for (gbq o_gbq : element2.ˍ()) {
                if (!(o_gbq instanceof gbn) && !(o_gbq instanceof gby) && !(o_gbq instanceof gbo)) {
                    return false;
                }
            }
            return true;
        }

        public String toString() {
            return ":empty";
        }
    }

    public static class z extends o {
        public z(int i, int i2) {
            super(i, i2);
        }

        protected int ॱ(Element element, Element element2) {
            Iterator it = element2.ᐝॱ().ॱˎ().iterator();
            int i = 0;
            while (it.hasNext()) {
                Element element3 = (Element) it.next();
                if (element3.ʻॱ().equals(element2.ʻॱ())) {
                    i++;
                    continue;
                }
                if (element3 == element2) {
                    break;
                }
            }
            return i;
        }

        protected String ˏ() {
            return "nth-of-type";
        }
    }

    public static final class x extends z {
        public x() {
            super(0, 1);
        }

        public String toString() {
            return ":first-of-type";
        }
    }

    public static final class y extends gck {
        public boolean ˎ(Element element, Element element2) {
            Element ᐝॱ = element2.ᐝॱ();
            return (ᐝॱ == null || (ᐝॱ instanceof Document) || element2.ʿ() != 0) ? false : true;
        }

        public String toString() {
            return ":first-child";
        }
    }

    public abstract boolean ˎ(Element element, Element element2);

    protected gck() {
    }
}
